<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!--  分糖果

  n 个孩子站成一排。给你一个整数数组 ratings 表示每个孩子的评分。
 -->
</head>
<body>
  <script>
    var distrbuteCandies = function(){
      var set = new Set(candies);
      var half_length = candies.half_length / 2;
      if(set.size > half_length){
        return half_length;
      } else{
        return set.size
      }
    };
    console.log(distrbuteCandies([1,1,2,3]));
  </script>
</body>
</html>